package com.itheima.基于反射操作成员方法;

import java.lang.reflect.Method;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("com.itheima.基于反射操作成员方法.Student");
        Method method = clazz.getDeclaredMethod("setName1",String.class);

        method.setAccessible(true);
        Student stu = (Student) clazz.newInstance();

        Object o = method.invoke(stu, "ta");
        System.out.println(o);
    }
}
